package br.com.fiap.cincoMob.TrabalhoFinal;

import java.util.ArrayList;
import java.util.List;

public class StringUtils {
	private final static List<String> OPERATORS_SYMBOLS = new ArrayList<String>();
	
	static{
		OPERATORS_SYMBOLS.add("+");
		OPERATORS_SYMBOLS.add("-");
		OPERATORS_SYMBOLS.add("*");
		OPERATORS_SYMBOLS.add("/");
	}
	
	public static boolean isEmpty(String str){
		return ((str != null) && str.trim().isEmpty());
	}

	public static boolean validateDouble(String number){
		try{
			Double.parseDouble(number);
		}catch (NumberFormatException e) {
			return false;
		}
		return true;
	}	
	
	public static boolean validateInteger(String number){
		try{
			Integer.parseInt(number);
		}catch (NumberFormatException e) {
			return false;
		}
		return true;
	}	
	
	public static boolean validateOperator(String operator){
		return !StringUtils.isEmpty(operator) && OPERATORS_SYMBOLS.contains(operator);
	}	
}
